package com.xdw.logindemoforjava.slice;

import com.xdw.logindemoforjava.MainAbility;
import com.xdw.logindemoforjava.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;
import ohos.agp.components.TextField;
import ohos.agp.window.dialog.ToastDialog;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class MainAbilitySlice extends AbilitySlice {
    private static final HiLogLabel LABEL_LOG = new HiLogLabel(0, 0, "MainAbilitySlice.class");
    private Text text;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        text = findComponentById(ResourceTable.Id_txt);
        String username = intent.getStringParam("username");
        text.setText(username);
        text.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                setResult(intent.setParam("result","我是Main页面返回值"));
                terminate();
            }
        });
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }


}
